import type { ApiPriceComponent, PriceComponent } from '@/types';

export const mapComponentsForBackend = (
  priceComponents: PriceComponent[]
): ApiPriceComponent[] =>
  priceComponents.map(({ isNew, ...otherProps }) => ({ ...otherProps }));

export const mapComponentsForFrontend = (
  priceComponents: ApiPriceComponent[]
): PriceComponent[] =>
  priceComponents.map((component) => ({ ...component, isNew: false }));
